import { Catch } from '@midwayjs/decorator'
import { Context } from '@midwayjs/koa'

@Catch()
export class DefaultErrorFilter {
  async catch(err, ctx: Context) {
    // 所有的未分类错误会到这里
    console.log(err)

    ctx.status = err.status
    return {
      code: err.status,
      message: err.message
    }
  }
}
